package com.smmisia.shop.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum SpecialEnum {


    NORMAL(1, "原价"),
    SPECIAL(2, "特价");

    @EnumValue
    private Integer code;
    private String desc;

    SpecialEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static SpecialEnum getEnumByCode(Integer code) {
        for (SpecialEnum specialEnum : SpecialEnum.values()) {
            if (specialEnum.getCode().equals(code)) {
                return specialEnum;
            }
        }
        return null;
    }
}
